package com.xjh.basestudy.designmode.createMode.createMode3_FactoryMethod.p3_factory;

import com.xjh.basestudy.designmode.createMode.createMode3_FactoryMethod.p1_original.Enemy;
import com.xjh.basestudy.designmode.createMode.createMode3_FactoryMethod.p1_original.Tank;

import java.util.Random;

/**
 * @author XuJianHua
 * @date 2022-09-22 15:56:58
 * @description 坦克工厂实现类：实现工厂方法，并通过坦克实体的构造方法来初始化坐标
 */
public class TankFactory implements Factory {

    @Override
    public Enemy create(int screenWidth) {
        Random random = new Random();
        return new Tank(random.nextInt(screenWidth), 0);
    }

}